/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.liquidByte.trafficMustang.server.dataModel;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Alexandre
 */
@Entity
@Table(name = "veic")
public class Veiculo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "VEIC_ID")
    private Integer veicId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 12)
    @Column(name = "VEIC_PLAC")
    private String veicPlac;
    @Basic(optional = false)
    @NotNull
    @Column(name = "VEIC_LOTC")
    private short veicLotc;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 80)
    @Column(name = "VEIC_DESC")
    private String veicDesc;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 80)
    @Column(name = "VEIC_MODL")
    private String veicModl;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 80)
    @Column(name = "VEIC_MARC")
    private String veicMarc;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "VEIC_COR")
    private String veicCor;
    @OneToMany(mappedBy = "veicId")
    private List<Deslocamento> deslocamentoList;
    @JoinColumn(name = "MOTR_ID", referencedColumnName = "USR_ID")
    @ManyToOne(optional = false)
    private Motorista motrId;

    public Veiculo() {
    }

    public Veiculo(Integer veicId) {
        this.veicId = veicId;
    }

    public Veiculo(Integer veicId, String veicPlac, short veicLotc, String veicDesc, String veicModl, String veicMarc, String veicCor) {
        this.veicId = veicId;
        this.veicPlac = veicPlac;
        this.veicLotc = veicLotc;
        this.veicDesc = veicDesc;
        this.veicModl = veicModl;
        this.veicMarc = veicMarc;
        this.veicCor = veicCor;
    }

    public Integer getVeicId() {
        return veicId;
    }

    public void setVeicId(Integer veicId) {
        this.veicId = veicId;
    }

    public String getVeicPlac() {
        return veicPlac;
    }

    public void setVeicPlac(String veicPlac) {
        this.veicPlac = veicPlac;
    }

    public short getVeicLotc() {
        return veicLotc;
    }

    public void setVeicLotc(short veicLotc) {
        this.veicLotc = veicLotc;
    }

    public String getVeicDesc() {
        return veicDesc;
    }

    public void setVeicDesc(String veicDesc) {
        this.veicDesc = veicDesc;
    }

    public String getVeicModl() {
        return veicModl;
    }

    public void setVeicModl(String veicModl) {
        this.veicModl = veicModl;
    }

    public String getVeicMarc() {
        return veicMarc;
    }

    public void setVeicMarc(String veicMarc) {
        this.veicMarc = veicMarc;
    }

    public String getVeicCor() {
        return veicCor;
    }

    public void setVeicCor(String veicCor) {
        this.veicCor = veicCor;
    }

    public List<Deslocamento> getDeslocamentoList() {
        return deslocamentoList;
    }

    public void setDeslocamentoList(List<Deslocamento> deslocamentoList) {
        this.deslocamentoList = deslocamentoList;
    }

    public Motorista getMotrId() {
        return motrId;
    }

    public void setMotrId(Motorista motrId) {
        this.motrId = motrId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (veicId != null ? veicId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Veiculo)) {
            return false;
        }
        Veiculo other = (Veiculo) object;
        if ((this.veicId == null && other.veicId != null) || (this.veicId != null && !this.veicId.equals(other.veicId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.liquidByte.trafficMustang.server.dataModel.Veiculo[ veicId=" + veicId + " ]";
    }
    
}
